#-*-coding:utf8-*-
from django.http import HttpResponse
from Model.models import Shop,TicketType
import json
def ticket_kind_info(request):
    '''
    @author xjx
    @email arthursnoopyxu@foxmail.com
    @date 2017-9-24 11:10
    商家信息票类信息，所有商家信息，票类简介，票类名称，|| 单个票类 票类id 数量||订单数组所有信息 ||注意电子码    
    '''

    if request.method == 'GET':
        requestValue = request.GET['ticketKindId']
        ticketType = []
        ticket=TicketType.objects.get(id=requestValue)
        ticketKindId = ticket.id
        ticketKindName = ticket.ticket_name
        ticketKindOriginalPrice = ticket.original_price
        ticketKindPrice = ticket.price
        ticketTypeName = ticket.ticket_type
        ticketKindInfo = ticket.comment
        ticketKindEffectiveTime = str(ticket.effective_time)
        ticketKindAvatar = ticket.avatar
        ticketKindFailBit = ticket.fail_bit
        ticketType.append({'ticketKindId':ticketKindId,'ticketKindName':ticketKindName,'ticketKindOriginalPrice':ticketKindOriginalPrice,
        'ticketKindPrice':ticketKindPrice,'ticketTypeName':ticketTypeName,
        'ticketKindInfo':ticketKindInfo,'ticketKindEffectiveTime':ticketKindEffectiveTime,
        'ticketKindAvatar':ticketKindAvatar,'ticketKindFailBit':ticketKindFailBit,
        })
        kindInfo={'ticketType':ticketType}
        return HttpResponse(json.dumps(kindInfo, ensure_ascii=False), content_type="application/json;charset=utf8")
    else:
        return HttpResponse(json.dumps({'error':404}, ensure_ascii=False), content_type="application/json;charset=utf8")
